package com.sqx.modules.rechargeConfig.controller;


import com.sqx.common.utils.Result;
import com.sqx.modules.rechargeConfig.entity.RechargeConfig;
import com.sqx.modules.rechargeConfig.service.RechargeConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author wuchang
 * @since 2022-11-04
 */
@RestController
@RequestMapping("/admin/rechargeConfig/")
@Api(value = "充值配置", tags = {"充值配置-管理端"})
public class AdminRechargeConfigController {
    @Autowired
    private RechargeConfigService rechargeConfigService;

    @ApiOperation("添加充值配置")
    @PostMapping("addConfig")
    public Result addConfig(RechargeConfig rechargeConfig) {
        return rechargeConfigService.addConfig(rechargeConfig);
    }

    @ApiOperation("修改充值配置")
    @PostMapping("updateConfig")
    public Result updateConfig(RechargeConfig rechargeConfig) {
        return rechargeConfigService.updateConfig(rechargeConfig);
    }

    @ApiOperation("获取充值配置详情")
    @GetMapping("getConfigInfo")
    public Result getConfigInfo(Long rechargeId) {
        return Result.success().put("data", rechargeConfigService.getRechargeConfigInfo(rechargeId));
    }

    @ApiOperation("删除充值配置")
    @GetMapping("deleteConfig")
    public Result deleteConfig(Long rechargeId) {
        return rechargeConfigService.deleteConfig(rechargeId);
    }
    @ApiOperation("获取充值配置列表")
    @GetMapping("getConfigInfoList")
    public Result getConfigInfoList(Integer page,Integer limit,RechargeConfig rechargeConfig){
        return Result.success().put("data", rechargeConfigService.getConfigInfoList(page,limit,rechargeConfig));
    }
}

